{% extends "../layout.html" %}

{% block subtitle %}节点修改{% end %}
{% block style %}
  {% if node.icon_img %}
  <link rel="shortcut icon" href="{{ node.icon }}" type="image/x-icon" />
  {% end %}
  {% if node.head_img %}
  <style type="text/css">
    #head {
      background: url({{ node.head }});
      background-size: 100%;
    }
  </style>
  {% end %}
  {% if node.style %}
  <style type="text/css">
    {{ node.style }}
  </style>
  {% end %}
{% end %}
{% block script %}
<script src="{{ static_url('js/ext/ueditor/ueditor.config.js') }}"></script>
<script src="{{ static_url('js/ext/ueditor/ueditor.all.min.js') }}"></script>
<script type="text/javascript">
  var width = $('#shape').width();
  var ue = new UE.ui.Editor({initialFrameWidth: width * 0.75, initialFrameHeight: 300});
  ue.render("editor");
</script>
<script src="{{ static_url('js/node_create.js') }}"></script>
{% end %}
{% block body %}
<ul class="body-nav">
  <li>
    <a href="/"><i class="icon-home"></i>&nbsp;{{ handler.settings['site_name'] }}</a>
  </li>
  <li>
    <a href="/nodes">节点</a>
  </li>
  <li>
    <a href="{{ node.url }}">{{ escape(node.name) }}</a>
  </li>
  <li class="now">
    修改节点
  </li>
</ul>
<div class="organ topic-create nav-shadow">
  <div class="organ-head">
    基本信息
  </div>
  <div class="organ-body">
    {{ modules.NodeForm(form=form, button="创建") }}
  </div>
</div>
<div class="organ topic-create node-pic-edit nav-shadow">
  <div class="organ-head">
    样式信息
  </div>
  <div class="organ-body text-center">
    <div class="ico-preview">
      <img class="icon" src="{{ node.icon }}">
    </div>
    <div class="status-msg"></div>
    <button data-category="icon" class="set-node-img btn">设置节点图标</button>
    <div class="head-preview">
      <img src="{{ node.head }}">
    </div>
    <div class="status-msg"></div>
    <button data-category="head" class="set-node-img btn">设置头部背景</button>
    <div class="background-preview">
      <img src="{{ node.background }}">
    </div>
    <div class="status-msg"></div>
    <button data-category="background" class="set-node-img btn">设置背景</button>
    <form style="display: none;" method="post" action="/node/{{ node.id }}/upload" enctype="multipart/form-data" method="post">
      <input type="hidden" id="category" name="category" />
      <input data-category="icon" id='node-img-select' type="file" name="myimage" data-url="/node/{{ node.id }}/upload" multiple />
      {{ xsrf_form_html() }}
    </form>
  </div>
</div>
{% end %}
